﻿@* --------------------------------------------------------------------------------------------------------------------
// <copyright file="EditOptions.cshtml" company="Devbridge Group LLC">
// 
// Copyright (C) 2015,2016 Devbridge Group LLC
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/. 
// </copyright>
// 
// <summary>
// Better CMS is a publishing focused and developer friendly .NET open source CMS.
// 
// Website: https://www.bettercms.com 
// GitHub: https://github.com/devbridge/bettercms
// Email: info@bettercms.com
// </summary>
// -------------------------------------------------------------------------------------------------------------------- *@
@using BetterCms.Module.Pages.Content.Resources
@using BetterCms.Module.Pages.Mvc.EditableGrid
@using BetterCms.Module.Root;
@using BetterCms.Module.Root.Content.Resources
@using BetterCms.Module.Root.Mvc.Grids;
@using BetterCms.Module.Root.ViewModels.Shared;

@{
    var model = new EditableGridViewModel();

    model.ShowSearch = false;
    model.TopBlockClass = "bcms-top-block-holder";
    model.SaveButtonTitle = RootGlobalization.Button_Ok;
    model.AddHiddenFields = true;
    model.ShowMessages = false;
    model.TopBlockAddItemView = "~/Areas/bcms-pages/Views/Option/Partial/TopBlockAddItem.cshtml";
    model.Columns = new List<EditableGridColumn>
            {
                new EditableGridColumn(PagesGlobalization.Options_OptionKeyColumn, null, "key")
                    {
                        HeaderAttributes = "style=\"width: 250px;\"",
                        AutoFocus = true,
                        HiddenFieldName = "Options[{0}].OptionKey",
                        FocusIdentifier = "hasFocus"
                    },

                new EditableGridDropDownColumn(PagesGlobalization.Options_OptionTypeColumn, null, "calcType")
                    {
                        HeaderAttributes = "style=\"width: 100px;\"",
                        OptionsBind = "optionTypes",
                        ValueTextBind = "typeName",
                        CanBeEdited = false
                    },

                new OptionValueEditableGridColumn(PagesGlobalization.Options_OptionDefaultValueColumn, "defaultValueBinding", "customOptionDefaultTitleBinding")
                    {
                        HiddenFieldName = "Options[{0}].OptionDefaultValue",
                        FocusIdentifier = "valueHasFocus"
                    },

                new EditableGridHiddenField("type", "Options[{0}].Type"),
                new EditableGridHiddenField("customType", "Options[{0}].CustomType")
            };
}

@Html.Partial(RootModuleConstants.EditableGridTemplate, model)